<?php


class M_panel extends CI_Model {
    
    function getAllDataLoket(){
        return $this->db->where("loket_active",1)->get('m_loket');
    }
    
    function getMaxLoket($m_loket_id){
        $sql = "SELECT
                    IFNULL(MAX(t_pengunjung.pengunjung_seq),0)+ 1 pengunjung_seq 
                FROM
                    t_pengunjung
                LEFT JOIN
                    m_loket
                ON 
                    m_loket_id = loket_id
                WHERE
                    DATE(pengunjung_waktu) = DATE(now())
                AND m_loket_id = ".$m_loket_id."";
        return $this->db->query($sql);
    }
    
    function send($data){
        $this->db->insert('t_pengunjung',$data);
    }
}